﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace KingerRobot.PCRBW.SpiService;

public class MesOutCompletesImpl : IMesOutCompletesService
{
    public delegate Task CreateMesOutComplete(MesOutComplete mesOutComplete);
    public static event CreateMesOutComplete CreateMesOutCompleteEvent;

    IMesOutCompleteRepositories _mesOutCompleteRepositories = new MesOutCompleteRepositories();
    public List<MesOutComplete> QueryMesOutCompletesList()
    {
        Expression<Func<MesOutComplete, bool>> whereExpression = x => true;
        whereExpression = whereExpression.And(d => d.update_flag == 1);
        return   _mesOutCompleteRepositories.Query(whereExpression);
    }

    public int UpdateMesOutCompletesByUpdateFlag(MesOutComplete mesOutComplete)
    {
        Expression<Func<MesOutComplete, bool>> whereExpression = x => true;
        whereExpression = whereExpression.And(d => d.Id == mesOutComplete.Id);
        return _mesOutCompleteRepositories.Update(whereExpression,mesOutComplete);
    }
 

}
